

local command = {};
local json = require("helper/json");
local bridge = luajava.bindClass("com.lua.LJBridge");

function command.initPath(path)
    
end

function command.createServer(port)
    local tb = {params = port};
    return command.call("createServer",tb);
end

--实例化lua虚拟机
function command.launch(file)
    local tb = {params = file};
    return command.call("launch",tb);
end

function command.log(content)
    local tb = {params = content};
    return command.call("log",tb);
end

function command.callCommand(token,func,params)
    
    local tb1 = {token = token,func=func,params=params};
    local tb = {params=tb1};
    return command.call("callCommand",tb);
end

--调用客户端的func函数
--address:客户端的ID
--func:客户端的Strategy实现接口
--params:传输的bag包
function command.callRemote(address,func,params)
    local tb = {address = address,func = func,params = params};
    command.call("callClient",tb);
end
--群调客户端的func函数
--addressList:客户端的列表
--func:实现的Strategy接口
--params:bag包
function command.callRemote(addressList,func,params)
    local tb = {addressList = addressList,func = func,params = params};
    command.call("callClientGroup",tb);
end
function command.call(cmd,tb)
    tb.cmd = cmd;
    local val = bridge:call(json.encode(tb));
    return val;
end


function command.async(cmd,tb)

end
local Body = {};
Body.IArr = {};
Body.SArr = {};
Body.FArr = {};
local Header = {};
Header.Function = "Default";


function command.package(func)
    
end

function command.encode(data)

    return json.encode(data);
end
function command.decode(data)

    return json.decode(data);
end

return command;